/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.jm.financeiro.entity;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.SequenceGenerator;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.hibernate.annotations.LazyCollection;
import org.hibernate.annotations.LazyCollectionOption;

/**
 *
 * @author joao
 */
@Entity
@Table(name = "proposta_etapa", catalog = "salao", schema = "public")
@NamedQueries({
    @NamedQuery(name = "PropostaEtapa.findAll", query = "SELECT p FROM PropostaEtapa p")})
public class PropostaEtapa implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "proposta_etapa_id_etapa_seq")
    @SequenceGenerator(name = "proposta_etapa_id_etapa_seq", sequenceName = "proposta_etapa_id_etapa_seq", initialValue = 1, allocationSize = 1)
    @Basic(optional = false)
    @NotNull
    @Column(name = "id_etapa", nullable = false)
    private Integer idEtapa;
    @Size(max = 200)
    @Column(name = "nom_etapa", length = 200)
    private String nomEtapa;
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "idEtapa")
    @LazyCollection(LazyCollectionOption.FALSE)
    @org.hibernate.annotations.Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
    private List<PropostaEtapaDesc> propostaEtapaDescList;

    public PropostaEtapa() {
    }

    public PropostaEtapa(Integer idEtapa) {
        this.idEtapa = idEtapa;
    }

    public Integer getIdEtapa() {
        return idEtapa;
    }

    public void setIdEtapa(Integer idEtapa) {
        this.idEtapa = idEtapa;
    }

    public String getNomEtapa() {
        return nomEtapa;
    }

    public void setNomEtapa(String nomEtapa) {
        this.nomEtapa = nomEtapa;
    }

    public List<PropostaEtapaDesc> getPropostaEtapaDescList() {
        return propostaEtapaDescList;
    }

    public void setPropostaEtapaDescList(List<PropostaEtapaDesc> propostaEtapaDescList) {
        this.propostaEtapaDescList = propostaEtapaDescList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idEtapa != null ? idEtapa.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof PropostaEtapa)) {
            return false;
        }
        PropostaEtapa other = (PropostaEtapa) object;
        if ((this.idEtapa == null && other.idEtapa != null) || (this.idEtapa != null && !this.idEtapa.equals(other.idEtapa))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "br.jm.financeiro.entity.PropostaEtapa[ idEtapa=" + idEtapa + " ]";
    }
}
